<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="Author" content="http://www.webqin.net">
<title>茉德精品火锅 </title>
<link rel="shortcut icon" href="images/favicon.ico" />
<script src="/carworld_weixin/js/jquery-3.3.1.min.js"></script>
<script src="/carworld_weixin/js/lyz.calendar.min.js"></script>
<!-- Bootstrap -->
<link href="/carworld_weixin/css/bootstrap.min.css" rel="stylesheet">
<link href="/carworld_weixin/css/admin.css" rel="stylesheet">
<link href="/carworld_weixin/css/style.css" rel="stylesheet">
<link href="/carworld_weixin/css/styles.css" rel="stylesheet">
<link href="/carworld_weixin/css/response.css" rel="stylesheet">
<script type="text/javascript" src="/carworld_weixin/js/moment.js"></script>
<script type="text/javascript" src="/carworld_weixin/js/bootstrap-datetimepicker.js"></script>
</head>
<body>

	<div class="maincont" style="height: 100%; margin: 0">
		<header>
			<a href="javascript:history.back(-1)" class="back-off fl"><span
				class="glyphicon glyphicon-menu-left"></span></a>
			<div class="head-mid">
				<h1>会员分红统计</h1>
			</div>
		</header>
		<!-- <div class="head-top">
			<img src="/carworld_weixin/images/verificate_banner.jpg" />
		</div> -->
		<!--head-top/-->
		<div class="row">
			<div class="col-sm-1">
				<div class="block block-success">
					<div class="clearfix">
						<h1 class="pull-left" id="dayIncome"></h1>
						<div class="pull-right"></div>
					</div>
					<div class="clearfix">
						<div class="pull-left">今日分红</div>
						<div class="pull-right fz12">对比昨日</div>
					</div>

					<div class="progress">

						<div
							class="progress-bar progress-bar-success progress-bar-striped"
							style="width: 100%">100%</div>

					</div>
				</div>
			</div>

			<div class="col-sm-2">
				<div class="block block-success">
					<div class="clearfix">
						<h1 class="pull-left" id="monthIncome" ></h1>
						<div class="pull-right"></div>
					</div>
					<div class="clearfix">
						<div class="pull-left">本月分红</div>
						<div class="pull-right fz12 ">对比上月</div>
					</div>

					<div class="progress">

						<div
							class="progress-bar progress-bar-success progress-bar-striped"
							style="width: 100%">100%</div>
					</div>
				</div>

			</div>

			<div class="col-sm-2">

				<div class="block block-success">
					<div class="clearfix">
						<h1 class="pull-left" id="yearIncome" ></h1>
						<div class="pull-right"></div>
					</div>
					<div class="clearfix">
						<div class="pull-left" >本年分红</div>
						<div class="pull-right fz12 ">对比去年</div>
					</div>
					<div class="progress">

						<div
							class="progress-bar progress-bar-success progress-bar-striped"
							style="width: 100%">100%</div>
					</div>
				</div>
			</div>

		</div>
		
		<div class="container-fluid">
			<div class="row-fluid">
				<div class="span12"><span><strong>根据日期查看分红收益</strong></span>
				</div>
			</div>
		</div>

		<div class="iDate full">
			<input type="text" id="beginTime">
			<button type="button" class="addOn"></button>
		</div>
		<div class="iDate date">
			<input type="text" id="endTime">
			<button type="button" class="addOn"></button>

		</div>
		<button type="button" class="btn btn-primary active"
			onclick="selectDate()">查询</button>
	</div>
	<script type="text/javascript">
	$.ajax({
		type : 'GET',
		url : '/carworld_weixin/dividend/getSumIncomeByTime',
		dataType : 'json',
		contentType : 'application/json',
		success : function(data) {
			console.log(data);
			var dayIncome=data.dayIncome;
			var monthIncome=data.monthIncome;
			var yearIncome=data.yearIncome;
			if(dayIncome.length==0){
				$('#dayIncome').html("0.00");
			}else{
				$('#dayIncome').html(dayIncome[0].sumIncome.toFixed(2));
			}
			if(monthIncome.length==0){
				$('#monthIncome').html("0.00");
			}else{
				$('#monthIncome').html(monthIncome[0].sumIncome.toFixed(2));
			}
			if(yearIncome.length==0){
				$('#yearIncome').html("0.00");
			}else{
				$('#yearIncome').html(yearIncome[0].sumIncome.toFixed(2));
			}
		
		}
			
	});
	
	
		$(document).ready(function() {
			if ($(".iDate.full").length > 0) {
				$(".iDate.full").datetimepicker({
					locale : "zh-cn",
					format : "YYYY-MM-DD",
					dayViewHeaderFormat : "YYYY年 MMMM"
				});
			}
			if ($(".iDate.date").length > 0) {
				$(".iDate.date").datetimepicker({
					locale : "zh-cn",
					format : "YYYY-MM-DD",
					dayViewHeaderFormat : "YYYY年 MMMM"
				});
			}
		})

		function selectDate() {
			var beginTime=$("#beginTime").val();
			var endTime=$("#endTime").val();
			$.ajax({
				type : 'GET',
				url : '/carworld_weixin/dividend/getPageOfIncome',
				data : {
					'beginTime' : beginTime,
					'endTime' : endTime
				},
				dataType : 'json',
				success : function(result) {
					var data=result.page.list;
					if(data.length!=0){
						alert('在'+beginTime+'至'+endTime+'分红收益总额为:'+data[0].sumIncome.toFixed(2));
					}else{
						alert('暂无收益~');
					}
				},
				error : function(jqXHR, textStatus, errorThrown) {
					alert(textStatus);
					
				}
			});

		}
		
		
	</script>
	
</head>

</body>
</html>